//
//  MainViewVC.swift
//  AliBaiChuan
//
//  Created by 郑东喜 on 2017/2/9.
//  Copyright © 2017年 郑东喜. All rights reserved.
//  主界面tabbarVC

import UIKit

class MainViewVC: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        ///测试功能页
        let firNav : UINavigationController = UINavigationController.init(rootViewController: ViewController())
        
        let testVC : UINavigationController = UINavigationController.init(rootViewController: TableViewController())

        ///功能项页面
        
        self.setupChildVC(testVC, title: "测试", imageName: "", selectImageName: "")
        
        self.setupChildVC(firNav, title: "功能页面", imageName: "", selectImageName: "")

        
        
        view.backgroundColor = UIColor.white
    }
}

extension MainViewVC {
    //添加子页面
    func setupChildVC(_ childVC: UIViewController,title: String,imageName: String,selectImageName: String) {
        
        childVC.title = title
        childVC.tabBarItem.image = UIImage.init(named: imageName)
        //        不在渲染图片
        childVC.tabBarItem.selectedImage = UIImage.init(named: selectImageName)?.withRenderingMode(.alwaysOriginal)
        
        self.addChildViewController(childVC)

    }
}


